package com.shop.member.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Repository;

import com.shop.member.vo.MemberVO;

@Repository
public class MemberOutDAOImpl extends SqlSessionDaoSupport implements MemberOutDAO {

	@Override
	@SuppressWarnings("unchecked")
	public List<MemberVO.MemberOutItem> listMember() {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		
		return getSqlSession().selectList("com.shop.member.out.list", paramMap);
	}
	
	/**
	 * 탈퇴회원 등록
	 * @return
	 */
	public int addMember(MemberVO.MemberOutItem memberItem) {
		
		return getSqlSession().insert("com.shop.member.out.add", memberItem);
	}

	/**
	 * 탈퇴회원 상세조회
	 * @param member_seq
	 * @return
	 */
	public MemberVO.MemberOutItem getMember(String member_seq) {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("member_seq", member_seq);
		return (MemberVO.MemberOutItem)getSqlSession().selectOne("com.shop.member.out.get", paramMap);
	}
	/**
	 * 탈퇴회원 수정
	 * @return
	 */
	public int updateMember(MemberVO.MemberOutItem memberItem) {
		
		return getSqlSession().update("com.shop.member.out.update", memberItem);
	}
	
	/**
	 * 탈퇴회원 삭제
	 * @param member_seq
	 * @return
	 */
	public int deleteMember(String member_seq) {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("member_seq", member_seq);
		return getSqlSession().delete("com.shop.member.out.delete", paramMap);
	}
	

}
